package zhuyun.code

class ArrayList<E>:Collection<E>{
    override fun add(e: E): Boolean {
        val any = e as Any
        elementData[size++] = e
        return true
    }

    override fun remove(any: Any): Boolean {
        return false

    }
    private var size:Int = 0
    private lateinit var elementData:Array<Any>
    constructor(initialCapacity:Int){
        if(initialCapacity>=0){
            elementData = Array<Any>(initialCapacity, init={ 0})
        } else {
            throw IllegalArgumentException("Illegal Capacity:$initialCapacity")
        }
    }
    constructor():this(0){
    }
    override fun isEmpty(): Boolean {
        return false
    }

    override fun iterator(): Iterator<E>? {
        return null
    }

    override fun size(): Int {
        return 0
    }
}